<template>
  <div class="box_line">
    <div class="title">
      <p>未来七天游客数量趋势图</p>
      <img src="../../images/dataScreen-title.png" alt="">
    </div>
    <div class="charts" ref="line">

    </div>
  </div>
</template>
<script setup lang='ts' name='line'>
import { onMounted, ref } from 'vue';
import * as echarts from 'echarts'
let line = ref()
onMounted(() => {
  let mycharts = echarts.init(line.value)
  let options = {
    xAxis: {
      type: 'category',
      boundaryGap: false,//两侧不留白
      splitLine:{//分割线
        show:false
      },
      data:['周一','周二','周三','周四','周五','周六','周七',]
    },
    yAxis: {
      splitLine:{//分割线
        show:false
      },
      axisLine:{
        show:true
      },
      axisTick:{
        show:true
      }
    },
    grid: {
      left: 40,
      top: 10,
      right: 10,
      bottom: 25,
    },
    series: [
      {
        type: 'line',
        data: [120, 240, 515, 646, 727, 1200, 890],
        smooth: true,
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [{
              offset: 0, color: 'red' // 0% 处的颜色
            }, {
              offset: 1, color: 'blue' // 100% 处的颜色
            }],
            global: false // 缺省为 false
          }
        }
      }
    ]
  }
  mycharts.setOption(options)
})
</script>


<style scoped>
.box_line {
  width: 96%;
  height: 100%;
  background: url(../../images/dataScreen-main-cb.png) no-repeat;
  background-size: 100% 100%;
  margin: 20px 20px;

  .title {
    color: white;
    font-size: 18px;
    margin-left: 20px;
  }

  .charts {
    height: calc(100% - 60px);
    margin-top: 40px;
  }
}
</style>